<template lang="">
    <div class="record">
        <el-table :data="tableData" style="width: 100%">
            <el-table-column label="浏览时间" prop="date">
            </el-table-column>
            <el-table-column label="商品名称" prop="name">
            </el-table-column>
            <el-table-column align="right" label="操作">
                <template slot-scope="scope">
                    <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">前往</el-button>
                    <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">
                        删除</el-button>
                </template>
            </el-table-column>
        </el-table>

        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
            :current-page="searchForm.currentPage" :page-sizes="[5, 10, 15, 20]" :page-size="searchForm.pageSize"
            layout="total, sizes, prev, pager, next, jumper" :total="totalPages">
        </el-pagination>

 
    </div>
</template>
<script>
    export default {
        data() {
            return {
                totalPages:40,
                searchForm: {
                    currentPage: 1,
                    pageSize: 5,
                    userID: '',
                    type: ''
                }
            }
        },
        mounted() {
            this.searchForm.type = this._props.type
        },
        props: {
            tableData: {
                type: Array,
                required: true
            },
            type: {
                type: String,
                required: true
            }
        },
        methods: {
            handleEdit(index, row) {
                console.log(index, row);
            },
            handleDelete(index, row) {
                console.log(index, row);
            },
            handleCurrentChange(val) {
                this.searchForm.currentPage = val
            },
            handleSizeChange(val){
                this.searchForm.pageSize = val
            }
        },
    }
</script>
<style lang="less" scoped>
    @import url('@/assets/less/record.less');
</style>